package Server;

import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

/**
 * Sets up a GridBagLayout and adds its components.
 * 
 * @param All
 *            components
 * @return Initializes the componentPanel's components.
 * @author Thomas Felder
 */
public class componentPanel extends JPanel {

	protected JButton btn_start_Server = new JButton("Start Server");
	protected JButton btn_stop_Server = new JButton("Stop Server");
	private JLabel lb_commands = new JLabel("Commands");
	protected int players_Count = 0;
	private JLabel lb_players_Connected = new JLabel("Players: "
			+ players_Count);

	// protected JTextArea txtA_message = new JTextArea(5,20);

	public componentPanel() {

		initComponents();

	}

	public void initComponents() {

		setLayout(new GridBagLayout());
		GridBagConstraints gbc = new GridBagConstraints();
		gbc.insets = new Insets(5, 5, 5, 5);
		// JLabel command
		gbc.gridy = 0;
		gbc.gridx = 0;
		gbc.anchor = GridBagConstraints.FIRST_LINE_START;
		add(lb_commands, gbc);
		// JButton start_server
		gbc.gridy = 1;
		gbc.gridx = 0;
		add(btn_start_Server, gbc);
		// JButton stop_server
		gbc.gridy = 1;
		gbc.gridx = 1;
		btn_stop_Server.setEnabled(false);
		add(btn_stop_Server, gbc);
		// JLabel players_Connected
		gbc.gridy = 2;
		gbc.gridx = 0;
		add(lb_players_Connected, gbc);
	}

}
